import java.util.List;
import java.util.Scanner;

class SpecificRoute implements Route {
    public String name;
    public List<String> stations;
    public String startStation;
    public String endStation;

    public SpecificRoute(String name, List<String> stations, String startStation, String endStation) {
        this.name = name;
        this.stations = stations;
        this.startStation = startStation;
        this.endStation = endStation;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<String> getStations() {
        return stations;
    }

    public void setStations(List<String> stations) {
        this.stations = stations;
    }

    public String getStartStation() {
        return startStation;
    }

    public void setStartStation(String startStation) {
        this.startStation = startStation;
    }

    public String getEndStation() {
        return endStation;
    }

    public void setEndStation(String endStation) {
        this.endStation = endStation;
    }

    /* @Override
        public double getDistance() {
            return stations.size() * 2;
        }*/
    @Override
    public double getFare() {
        return stations.size() * 1;
    }

   @Override
    public void addStation(String station) {
        System.out.println("要增加的站点信息为:" + station);
        stations.add(station);
    }

   // @Override
    public void removeStation(String station) {
        System.out.println("要删除的站点信息为:" + station);
        stations.remove(station);
    }

    @Override
    public void updateStation(String oldStation, String newStation) {
        System.out.println("要更改的站点信息为:" + oldStation + "->" + newStation);
        int index = stations.indexOf(oldStation);
        if (index != -1) {
            stations.set(index, newStation);
        }
    }

    public boolean contain(String s){
        for (String station : stations) {
            if(station.equals(s)){
                return true;
            }
        }
        return false;
    }
   // @Override
    public void queryStations(String s) {
        if(!contain(s)){
            return;
        }
        System.out.println(this.name+ "的站点有：");
        for (String station : stations) {
            System.out.print(station+">");
        }
        System.out.println();
      //  System.out.println(getDistance());
        System.out.println("花费:"+getFare());
        System.out.println();
    }

}
